package com.campus.client.controller;


import com.campus.client.net.ClientConnector;
import com.campus.common.message.TeacherChangeInfoResponse;

import com.campus.common.vo.TeacherRequest;


import javax.swing.*;
import java.io.IOException;
import java.util.List;

public class TeacherApprovalController {
    private ClientConnector connector;

    public TeacherApprovalController(ClientConnector connector) {
        this.connector = connector;
    }

    public List<TeacherRequest> loadAllRequest() throws ClassNotFoundException, IOException {
        TeacherChangeInfoResponse resp = connector.listTeacherRequests();
        return resp.getTeacherRequests();
    }

    public boolean deleteRequest(String id,String contactInfo) throws ClassNotFoundException, IOException {
        TeacherChangeInfoResponse resp = connector.deleteTeacherRequest(id,contactInfo);
        return resp.isSuccess();
    }

    public boolean upDateStudent(String id,String contactInfo) throws ClassNotFoundException, IOException {
        TeacherChangeInfoResponse resp = connector.updateTeacherInfo(id,contactInfo);
        return resp.isSuccess();
    }

    // 可选：结束会话时关闭连接
    public void closeConnection() throws IOException {
        connector.close();
    }
}
